package com.wenyu.wenyuyuedu.global;

import android.app.Application;
import android.content.Context;
import android.util.Log;

import com.umeng.message.IUmengRegisterCallback;
import com.umeng.message.PushAgent;

import org.xutils.x;

import cn.sharesdk.framework.ShareSDK;

/**
 * 全局的参数
 */
public class MyApplication extends Application {

    /**
     * 全局上下文
     */
    public static Context mApp;

    @Override
    public void onCreate() {
        super.onCreate();
        /*
        * 初始化分享
        * */
        ShareSDK.initSDK(this);
        /*
        * xutils的初始化
        * */
        x.Ext.init(this);
        PushAgent mPushAgent = PushAgent.getInstance(this);
        //注册推送服务，每次调用register方法都会回调该接口
        mPushAgent.register(new IUmengRegisterCallback() {

            @Override
            public void onSuccess(String deviceToken) {
                //注册成功会返回device token
                Log.d("mytoken", deviceToken);
            }

            @Override
            public void onFailure(String s, String s1) {
            Log.d("mytoken",s + "-----" + s1);
            }
        });

        mApp = this;
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
    }
}
